<?php

use Illuminate\Support\Facades\Route;
// Route::post('adminapi/user/login', 'AdminApi\User\LoginController@Login'); 
// Route::get('adminapi/user/login', 'AdminApi\User\LoginController@Login'); 
// return 1;
// echo 1; die;
Route::get('adminapi/user/login', function () {
    return 111;
}); //用户登录
Route::post('adminapi/user/login', 'AdminApi\User\LoginController@Login'); //用户登录
Route::get('adminapi/user/get', 'AdminApi\User\LoginController@Login'); //用户登录
Route::get('adminapi/folder/getWordList', 'AdminApi\User\FolderController@getWordList'); //上传word协议

// echo 2; die;
Route::group(['middleware' => ['AdminApiAuth'], 'prefix' => 'adminapi', 'as' => 'adminapi.'], function () {
    Route::post('user/logout', 'AdminApi\User\LoginController@logout'); //退出登录
    Route::get('user/info', 'AdminApi\User\LoginController@info'); //获取当前用户信息
});
Route::get('adminapi/permissions/updatePermissions', 'AdminApi\User\PermissionsController@updatePer'); //修改权限信息

//权限
Route::group(['middleware' => ['AdminApiAuth'], 'prefix' => 'adminapi', 'as' => 'adminapi.'], function () {
    Route::get('/permissions/getPermissions', 'AdminApi\User\PermissionsController@index'); //查询权限
    Route::post('/permissions/insertPermissions', 'AdminApi\User\PermissionsController@insertPermissions'); //添加权限
    Route::post('/permissions/updatePermissions', 'AdminApi\User\PermissionsController@updatePer'); //修改权限信息
    Route::post('/permissions/deletePermissions', 'AdminApi\User\PermissionsController@destroy'); //删除权限
    Route::get('/classify/getClassify', 'AdminApi\User\ClassifyController@getClassify'); //角色选择框查询
});

//角色
Route::group(['middleware' => ['AdminApiAuth'], 'prefix' => 'adminapi', 'as' => 'adminapi.'], function () {
    Route::get('/classify/getClassifyPermissions', 'AdminApi\User\ClassifyController@getClassifyPermissions'); //查询角色
    Route::post('/classify/insertClassifyPermissions', 'AdminApi\User\ClassifyController@insertClassifyPermissions'); //添加角色
    Route::post('/classify/updateClassifyPermissions', 'AdminApi\User\ClassifyController@updateClassifyPermissions'); //修改角色信息
    Route::post('/classify/deleteClassifyPermissions', 'AdminApi\User\ClassifyController@deleteClassifyPermissions'); //删除角色
    Route::get('/classify/getClassify', 'AdminApi\User\ClassifyController@getClassify'); //角色选择框查询
});

//管理員
Route::group(['middleware' => ['AdminApiAuth'], 'prefix' => 'adminapi', 'as' => 'adminapi.'], function () {
    Route::get('/member/getAllUser', 'AdminApi\User\UserController@getAllUser'); //查询人員
    Route::get('/member/getStaff', 'AdminApi\User\UserController@getStaff'); //获取员工信息
    Route::post('/member/insertUser', 'AdminApi\User\UserController@insertUser'); //添加人員
    Route::post('/member/updateUser', 'AdminApi\User\UserController@updateUser'); //修改人员信息
    Route::post('/member/deleteUser', 'AdminApi\User\UserController@deleteUser'); //删除人员
    Route::get('/member/getRoles', 'AdminApi\User\UserController@getRoles'); //查询已有角色 
    Route::post('/member/updateMessage', 'AdminApi\User\UserController@updateMessage'); //修改当前登录用户信息
});

//人员管理
Route::group(['middleware' => ['AdminApiAuth'], 'prefix' => 'adminapi', 'as' => 'adminapi.'], function () {
    // 督查员
    Route::group(['prefix' => 'inspection', 'as' => 'inspection.'], function () {
        Route::post('/create', 'AdminApi\Member\InspectionController@create');
        Route::post('/update', 'AdminApi\Member\InspectionController@update');
        Route::post('/delete', 'AdminApi\Member\InspectionController@delete');
        Route::get('/getinfo', 'AdminApi\Member\InspectionController@getinfo');
        Route::get('/list', 'AdminApi\Member\InspectionController@list');
    });
    // 街道管理员
    Route::group(['prefix' => 'street', 'as' => 'street.'], function () {
        Route::post('/create', 'AdminApi\Member\StreetController@create');
        Route::post('/update', 'AdminApi\Member\StreetController@update');
        Route::post('/delete', 'AdminApi\Member\StreetController@delete');
        Route::get('/getinfo', 'AdminApi\Member\StreetController@getinfo');
        Route::get('/list', 'AdminApi\Member\StreetController@list');
    });
    // 部门管理员
    Route::group(['prefix' => 'department', 'as' => 'department.'], function () {
        Route::post('/create', 'AdminApi\Member\DepartmentController@create');
        Route::post('/update', 'AdminApi\Member\DepartmentController@update');
        Route::post('/delete', 'AdminApi\Member\DepartmentController@delete');
        Route::get('/getinfo', 'AdminApi\Member\DepartmentController@getinfo');
        Route::get('/list', 'AdminApi\Member\DepartmentController@list');
    });
});

//分类
Route::group(['middleware' => ['AdminApiAuth'], 'prefix' => 'adminapi', 'as' => 'adminapi.'], function () {
    Route::get('/category/list', 'AdminApi\Category\CategoryController@list'); //查询分类列表
    Route::post('/category/addCate', 'AdminApi\Category\CategoryController@addCate'); //添加分类
    Route::post('/category/getinfo', 'AdminApi\Category\CategoryController@getinfo'); //查询一条数据
    Route::post('/category/updateCate', 'AdminApi\Category\CategoryController@updateCate'); //修改分类
    Route::post('/category/deleteCate', 'AdminApi\Category\CategoryController@deleteCate'); // 删除分类
});


//街道管理
Route::group(['middleware' => ['AdminApiAuth'], 'prefix' => 'adminapi', 'as' => 'adminapi.'], function () {
    // 街道列表
    Route::group(['prefix' => 'road', 'as' => 'road.'], function () {
        Route::post('/create', 'AdminApi\Street\RoadController@create');
        // Route::post('/update', function () {
        //     return 111;
        // }); //用户登录
        Route::post('/update', 'AdminApi\Street\RoadController@update');
        Route::post('/delete', 'AdminApi\Street\RoadController@delete');
        Route::get('/getinfo', 'AdminApi\Street\RoadController@getinfo');
        Route::get('/list', 'AdminApi\Street\RoadController@list');
        Route::get('/personnelList', 'AdminApi\Street\RoadController@personnelList'); //获取街道人员
        Route::get('/departmentList', 'AdminApi\Street\RoadController@departmentList'); //获取部门人员


    });
});
